<%-- 
    Document   : request_role
    Created on : 23/09/2011, 03:22:48 PM
    Author     : Jose
--%>

<%@ page import="PaquetesJL.*" %>
<%@page import="java.sql.ResultSet" %>

<% 
    String nombre_rol=request.getParameter("nombre_rol");        
    Integer solicitud=Integer.parseInt(request.getParameter("tipo_solicitud"));
        
    if(solicitud==1){
        String sqlServer = pageContext.getServletContext().getInitParameter("sqlServer");
        String databaseName = pageContext.getServletContext().getInitParameter("databaseName");
        String userName = pageContext.getServletContext().getInitParameter("userName");
        String PasswordP = pageContext.getServletContext().getInitParameter("password");
        String Backup = pageContext.getServletContext().getInitParameter("RutaBackup");
        
        byte[] decodedBytes = ConexionBD.decode(PasswordP);
        String decodedPassword = new String(decodedBytes).trim();
        
        ConexionBD Conexion = new ConexionBD(sqlServer, databaseName, userName, decodedPassword, Backup);
        Conexion.IniciarConexion();
        ResultSet r=Conexion.EjecutarConsulta("EXEC dbo.CrearRol '"+nombre_rol+"';");
        if(r.next()){
            out.print(r.getString(1));            
        }
               
        Conexion.CerrarConexion();        
    }    
%>